home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
301_400
/
DISK0315
/
DISK0315.ZIP
/
ISAMC.LBR
/
ISAMPRV.C
< prev
next >
Wrap
Text File
|
1984-11-28
|
896b
|
40 lines
/*
** ISAMC - Written by John M. Dashner
*/
#include <stdio.h>
#include <ctype.h>
#include <isam.h>
/*
** GET PREVIOUS - Sequential Index Traverse
*/
isamprv(hdr)
struct isam *hdr;
{
char buf[MAXKEY + 2];
long lrec;
struct rec3 *r3;
r3 = (struct rec3 *) buf;
hdr->q4 -= 1; /* decrement current record */
if (hdr->q4 == 1)
{
isam_err = 2; /* boundary limit */
return ERROR;
}
lrec = hdr->q4 * (hdr->q6 + 2);
lseek(hdr->q7, lrec, 0);
if (read(hdr->q7, buf, hdr->q6 + 2) == ERROR)
{
isam_err = 8;
return ERROR;
}
if (r3->idx_key[0] == 255)
return(isamprv(hdr)); /* recurse on deleted record */
return r3->rec_ptr;
}